package com.liuf.thread.read;

import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;

import static java.util.concurrent.Executors.newFixedThreadPool;

public class CompareTest {



    public static void main(String args[]) {

        final long millis1 = System.currentTimeMillis();
        final CyclicBarrier cb = new CyclicBarrier(1, new Runnable() {
            @Override
            public void run() {
                long millis2 = System.currentTimeMillis();
                System.out.println(millis2);
                System.out.println(millis2 - millis1);
            }
        });

        ReadTwo read = new ReadTwo(cb);
        //Executors.newFixedThreadPool(1);
        ExecutorService service = newFixedThreadPool(1);
        for (int i = 1; i <= 1; i++) {
            service.execute(new Thread(read, "线程" + i));
        }
    }

}
